package cc.mrbird.febs.power.service.impl;

import cc.mrbird.febs.power.entity.MenuInfo;
import cc.mrbird.febs.power.dao.MenuInfoMapper;
import cc.mrbird.febs.power.service.IMenuInfoService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author MrBird
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class MenuInfoServiceImpl extends ServiceImpl<MenuInfoMapper, MenuInfo> implements IMenuInfoService {

    private final MenuInfoMapper menuInfoMapper;

    @Override
    public IPage<List<Map>> getMenuInfoByPage(Page page, MenuInfo menuInfo) {
        return menuInfoMapper.getMenuInfoByPage(page,menuInfo);
    }

    public Integer menuBindAccount(MenuInfo menuInfo) {
        menuInfoMapper.insert(menuInfo);
        return menuInfo.getMenuId();
    }
}
